//
//  SettingTableCell.swift
//  koolcar
//
//  Created by xiantian on 2023/10/9.
//

import UIKit




class SettingTableCell: UITableViewCell {
    var titleLab: UILabel = {
        let tempLab = UILabel()
        tempLab.textColor = Theme.titleLabColor
        tempLab.backgroundColor = UIColor.clear
        tempLab.font = UIFont.init(name: Theme.PingFangSCMedium, size: 14)
        tempLab.numberOfLines = 1
        tempLab.lineBreakMode = .byTruncatingTail
        tempLab.textAlignment = .left
        return tempLab
    }()
    var rightTitleLab: UILabel = {
        let tempLab = UILabel()
        tempLab.textColor = Theme.placeholderColor
        tempLab.backgroundColor = UIColor.clear
        tempLab.font = UIFont.init(name: Theme.PingFangSCRegular, size: 12)
        tempLab.numberOfLines = 1
        tempLab.lineBreakMode = .byTruncatingTail
        tempLab.textAlignment = .right
        return tempLab
    }()
    var arrowImgView: UIImageView = {
        let imgView = UIImageView()
        imgView.image = UIImage.init(named: "icon_arrow_right_black")
        imgView.contentMode = .scaleAspectFit
        return imgView
    }()
    
    var lineView: UIView = {
        let tempView = UIView()
        tempView.backgroundColor = Theme.tfBorderColor
        return tempView
    }()

    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        contentView.addSubview(titleLab)
        contentView.addSubview(rightTitleLab)
        contentView.addSubview(arrowImgView)
        contentView.addSubview(lineView)
        self.addSnpLayout()
    }
    
    private func addSnpLayout(){
        titleLab.snp.makeConstraints { make in
            make.left.equalTo(24)
            make.top.equalTo(15)
            make.height.greaterThanOrEqualTo(20)
        }
        
        rightTitleLab.snp.makeConstraints { make in
            make.left.equalTo(titleLab.snp.right)
            make.centerY.equalTo(titleLab.snp.centerY)
            make.height.greaterThanOrEqualTo(20)
        }
        
        arrowImgView.snp.makeConstraints { make in
            make.left.equalTo(rightTitleLab.snp.right).offset(6)
            make.right.equalTo(-24)
            make.centerY.equalTo(titleLab.snp.centerY)
            make.width.equalTo(10)
            make.height.equalTo(10)
        }
        
        lineView.snp.makeConstraints { make in
            make.left.equalTo(14)
            make.right.equalTo(-14)
            make.top.equalTo(titleLab.snp.bottom).offset(15)
            make.height.equalTo(1)
            make.bottom.equalTo(-1)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
